package com.zhongc.advance.web.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

import com.zhongc.advance.common.log.Log;
import com.zhongc.advance.common.util.Env;

public class LogbackContextLoaderListener implements ServletContextListener {
	
	@Override
	public void contextDestroyed(ServletContextEvent contextEvent) {
		
	}

	@Override
	public void contextInitialized(ServletContextEvent contextEvent) {
		ServletContext context = contextEvent.getServletContext();
		String location = context.getRealPath(Env.analyze(context.getInitParameter("logbackContextConfigLocation")));
		System.out.println("logbackContextConfigLocation:" + location);
		Log.configure(location);
	}

}
